package jvs.tea.html;


import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.Date;

import x.java.io.File;
import x.java.tea.TemplateObjectInjector;

/**
 * 
 * @author qiangli
 * 
 */
public class Header extends TemplateObjectInjector {
	private static final String TPL = 
			"<span id=\"logo\"><a href=\"${link}\">${name}</a></span><br />"
			+ "<span id=\"info\">${jid} &nbsp; ${now}</span>"
			+ "<span id=\"user\">${user}</span>";
	private static final SimpleDateFormat df = new SimpleDateFormat(
			"EEE, yyyy-MM-dd HH:mm:ss.SSS z");
	protected URI context;
	protected File file;

	public class HeaderObject {
		public HeaderObject() {
		}
		
		public String getLink() {
			return context.toString();
		}
		
		public String getName() {
			return jvs.OS.name;
		}
		
		public String getNow() {
			return df.format(new Date());
		}

		public String getUser() {
			return "";
		}
		
		public String getJid() {
			return "";
		}
	}

	public Header(URI context, File file) {
		super(TPL);
		this.context = context;
		this.file = file;
		setObject(new HeaderObject());
	}
}
